package ChatSystem;

import chatsystemTDa2.Send;

/**
 * A specialized Sender which sends ChatTextMessages over a UDPSender.
 */
public class MessageSender extends Sender<ChatMessage.ChatTextMessage, UDPSender> {
	/**
	 * Creates the MessageSender.
	 * @param sender the UDPSender used to send messages.
	 */
	public MessageSender(UDPSender sender) {
		super(sender);
	}
	
	@Override
	protected void cancel() {}
	
	@Override
	protected void sendMessage(ChatMessage.ChatTextMessage message) {
		_sender.sendMessage(new Send(message.getMessage(), 0), message.getRecipient().getAddress(), message.getRecipient().getPort());
	}
}
